package main

import (
	"gin-demo/controller"
	"gin-demo/middleware"
	"github.com/gin-gonic/gin"
)

func SetupRouter() *gin.Engine{
	r := gin.Default()
	r.Use(middleware.CORSMiddleware())
	api := r.Group("/api")
	{
		authGroup := api.Group("auth")
		{
			authGroup.POST("/register", controller.Register)
			authGroup.POST("/login", controller.Login)
			authGroup.GET("/info", middleware.AuthMiddleware(),controller.Info)
		}
	}
	return r
}